//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package objects;

import java.util.Iterator;
import java.util.LinkedHashMap;

public class Fruits {
    private static final LinkedHashMap<Integer, FruitEntry> fruitsById = new LinkedHashMap();
    private static final LinkedHashMap<String, FruitEntry> fruitsByName = new LinkedHashMap();
    private static final LinkedHashMap<String, FruitEntry> fruitsByTree = new LinkedHashMap();

    public Fruits() {
    }

    public static void createFruitEntry(String Name, Integer UnlockLevel, String Tree, Integer DumbValue, Integer DiamondPrice, Integer ExpCollect) {
        FruitEntry fe = new FruitEntry(Name, UnlockLevel, Tree, DumbValue, DiamondPrice, Integer.valueOf(fruitsById.size()), ExpCollect);
        fruitsById.put(fe.getGlobalID(), fe);
        fruitsByName.put(fe.getName(), fe);
        fruitsByTree.put(fe.getTree(), fe);
    }

    public static FruitEntry getById(Integer id) {
        return (FruitEntry)fruitsById.get(id);
    }

    public static FruitEntry getByName(String name) {
        return (FruitEntry)fruitsByName.get(name);
    }

    public static FruitEntry getByTree(String feed) {
        return (FruitEntry)fruitsByTree.get(feed);
    }

    public static void clear() {
        fruitsById.clear();
        fruitsByName.clear();
        fruitsByTree.clear();
    }

    public static Object[] toArray() {
        return fruitsById.values().toArray();
    }

    public static int unlockedFruitsCount(int currentLevel) {
        int rval = 0;
        Iterator var3 = fruitsById.values().iterator();

        while(var3.hasNext()) {
            FruitEntry fe = (FruitEntry)var3.next();
            if(currentLevel >= fe.getUnlockLevel().intValue()) {
                ++rval;
            }
        }

        return rval;
    }
}
